// $Id: css_chooser.js 7280 2007-02-05 05:46:28Z jvogel01 $
// please keep this in sync with cgi-bin/style.css!

// return webteam name for browser
function browser(ua) {
    var b = "NETSCAPE6";    // assume something advanced

    if (ua.indexOf("Opera") == 0) {
       // opera
       b = "OPERA";
    } else if (ua.indexOf("iCab") == 0) {
       b = "ICAB";
    } else if (ua.indexOf("Mozilla/4") == 0) {
      // either netscape 4 or IE
      if (ua.indexOf("MSIE 4") >= 0)
        b = "IE4";
      else if (ua.indexOf("MSIE") >= 0) // "5 or higher"
        b = "IE5";
      else if (ua.indexOf("OmniWeb") >= 0)
        b = "OMNI";
      else
        b = "NETSCAPE4";
    } else if (ua.indexOf("Mozilla/5") >= 0) {
        if(ua.indexOf("Konqueror") >= 0)
            b = "KONQUEROR";
        else if (ua.indexOf("Netscape6") >= 0) 
            b = "NETSCAPE6";
        else if (ua.indexOf("Netscape/7") >= 0)
            b = "NETSCAPE7";
        else if (ua.indexOf("Chimera/") >= 0)
	    b = "CHIMERA";
        else if (ua.indexOf("Safari/") >= 0)
	    b = "SAFARI";
        else b = "MOZILLA";
    }
    return b;
}

function os(ua) {
    var o = "PC";           // assume something dodgy
    if (ua.indexOf("Linux") >= 0 || ua.indexOf("Unix") >= 0
    ||  ua.indexOf("X11") >= 0   || ua.indexOf("BSD") >= 0) {
      o = "UNIX";
    } else if (ua.indexOf("Mac") >= 0) {
      o = "MAC";
    }
    return o;
}

function css_link(prefix) {
    var debug = 0;
    var ua = navigator.userAgent;
    var b = browser(ua);
    var o = os(ua);

    var style = "<LINK rel=\"StyleSheet\" href=\"" + prefix + "-" +
	b + "-" + o + ".css\" type=\"text/css\">";

    if (debug) {
        var debugstr = "OS = " + o + ", Browser = " + b + " UA = " + ua;
        alert(debugstr);
        document.writeln("<TITLE>" + debugstr + "</TITLE>");
    }

//    alert(style);
    return style;
}
